import ajax from "@/utils/request";

// /regions地区分类
export function regionsFn(){
    return ajax({
        url: '/regions'
    })
}


// 获取分类数据
// /region-data/:categoryId
export function categoryFn(categoryId:number){
    return ajax({
        url: `/region-data/${categoryId}`
    })
}


// 新增搜索数据的接口
export function searchRegions(searchTerm: string) {
    return ajax({
        url: '/search-address',
        data: { q: searchTerm } // 传递搜索参数
    });
}



// /spot-details/:cityId   详情
export function spotDetailsFn(cityId:number){
    return ajax({
        url: `/spot-details/${cityId}`
    })
}

// /travel-guides/:cityId游玩攻略
export function travelGuidesFn(cityId:number){
    return ajax({
        url: `/travel-guides/${cityId}`
    })
}




// 加入旅行计划  /travel-plans
export function travelPlansFn(userId: number, recommendationId: number, spotId: number, title: string, rating: number) {
    return ajax({
        url: '/travel-plans',
        method: 'post',
        data: { userId, recommendationId, spotId, title, rating } // 传递用户 ID、推荐项 ID 和景点 ID
    });
}